package com.mall.huohuo.service.enums;

/**
 * @author yuanyuan.zhu
 * @version AdvertiseEnum.java, v 0.1 2020-08-19 23:02 yuanyuan.zhu
 */
public enum AdvertiseEnum {
    HOME("首页", 0),

    CATEGORY("分类", 1);

    private String name;
    private Integer value;

    AdvertiseEnum(String name, Integer value) {
        this.name = name;
        this.value = value;
    }

    /**
     * Getter method for property <tt>name</tt>.
     *
     * @return property value of name
     */
    public String getName() {
        return name;
    }

    /**
     * Getter method for property <tt>value</tt>.
     *
     * @return property value of value
     */
    public Integer getValue() {
        return value;
    }

    public static AdvertiseEnum getByValue(Integer value) {
        AdvertiseEnum[] valueList = AdvertiseEnum.values();
        for (AdvertiseEnum v : valueList) {
            if (v.getValue().equals(value)) {
                return v;
            }
        }
        throw new IllegalStateException("无效的广告位置。");
    }
}
